package server;

import java.util.Collection;
import java.util.Hashtable;
import java.util.List;

public class UserManager {

	private Hashtable<String,User> users;

	/**
	 * Getter of the property <tt>user</tt>
	 *
	 * @return Returns the user.
	 * 
	 */
	public UserManager()
	{
		
	}


	/**
	 * Returns <tt>true</tt> if this collection contains no elements.
	 *
	 * @return <tt>true</tt> if this collection contains no elements
	 * @see	java.util.Collection#isEmpty()
	 *
	 */
	public boolean isUserEmpty(){
		return users.isEmpty();
	}

	/**
	 * Returns <tt>true</tt> if this collection contains the specified element. 
	 *
	 * @param element whose presence in this collection is to be tested.
	 * @see	java.util.Collection#contains(Object)
	 *
	 */
	public boolean containsUser(User user){
		return this.users.contains(user);
	}

	public boolean containsUser(String userId){
		return this.users.containsKey(userId);
	}
	
	public void deleteUserById(String userId){
		this.users.remove(userId);
	}
	
	/**
	 * Returns the number of elements in this collection.
	 *
	 * @return the number of elements in this collection
	 * @see	java.util.Collection#size()
	 *
	 */
	public int userAmount(){
		return users.size();
	}

	/**
	 * Ensures that this collection contains the specified element (optional
	 * operation). 
	 *
	 * @param element whose presence in this collection is to be ensured.
	 * @see	java.util.Collection#add(Object)
	 *
	 */
	public void addUser(User user){
		this.users.put(user.getId(),user);
	}



	/**
	 * Removes all of the elements from this collection (optional operation).
	 *
	 * @see	java.util.Collection#clear()
	 *
	 */
	public void clearUser(){
		this.users.clear();
	}

			
	
	
}
